<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0040)http://www.mengma.com/class/lesson/518/0 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh-CN" class=" " style="overflow-y: hidden;"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script src="Array/hm.js"></script><script src="Array/id.php" charset="utf-8"></script>
	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="x-dns-prefetch-control" content="on">
	<meta name="renderer" content="webkit">
	<title>Array 数组 - 萌码</title>
	<meta name="author" content="Mengma">
	<meta name="description" content="萌码是计算教育领域的先行者，领先的跟随式教学、图形化教学等让计算学习更有趣、更高效。萌码和杰出的人一同前行，让人们享受最好的教育。">
	<meta name="keywords" content="萌码,教育,在线教育,在线编程教育,跟随式,图形化,编程,计算,代码,猛犸">
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=0">
	<meta property="og:type" content="website">
	<meta property="og:title" content="Array 数组 - 萌码">
	<meta property="og:url" content="http://www.mengma.com/class/lesson/518/0">
	<meta property="og:description" content="萌码是计算教育领域的先行者，领先的跟随式教学、图形化教学等让计算学习更有趣、更高效。萌码和杰出的人一同前行，让人们享受最好的教育。">
	<meta property="og:site_name" content="萌码">
	<meta property="og:image" content="http://s.mengma.com/img/mm_logo.png">
	<link rel="canonical" href="http://www.mengma.com/class/lesson/518/0">
	<link rel="shortcut icon" type="image/x-icon" href="http://www.mengma.com/favicon.ico">
	<link rel="icon" type="image/png" href="http://s.mengma.com/img/mm_icon.png">
	<link rel="dns-prefetch" href="http://www.mengma.com/">
	<link rel="dns-prefetch" href="http://passport.mengma.com/">
	<link rel="dns-prefetch" href="http://profile.mengma.com/">
	<link rel="dns-prefetch" href="http://ask.mengma.com/">
	<link rel="dns-prefetch" href="http://s.mengma.com/">
	<link rel="dns-prefetch" href="http://www.google-analytics.com/">
	<link rel="stylesheet" type="text/css" href="Array/bootstrap.min_385b96--.css">
	<link rel="stylesheet" type="text/css" href="Array/font-awesome.min_234f99--.css">
	<link rel="stylesheet" href="Array/font-awesome_cadcd2--.css" type="text/css">
	<link rel="stylesheet" type="text/css" href="Array/nprogress_712236--.css">
	<link rel="stylesheet" type="text/css" href="Array/mm_common_dc4502--.css">
	<link rel="stylesheet" type="text/css" href="Array/mm_lesson_71b00c--.css">
	<!--[if lt IE 9]><script type="text/javascript" src="http://s.mengma.com/js/html5shiv.min_2536f8--.js"></script><script type="text/javascript" src="http://s.mengma.com/js/respond.min_9cccbc--.js"></script><![endif]-->
	<script type="text/javascript" src="Array/markdown.min_6eecac--.js"></script>
	<script type="text/javascript" src="Array/marked_4af72c--.js"></script>

	<link rel="stylesheet" type="text/css" href="Array/codemirror.css">
	<link rel="stylesheet" type="text/css" href="Array/midnight.css">
	<link rel="stylesheet" type="text/css" href="Array/foldgutter.css">
	<link rel="stylesheet" type="text/css" href="Array/dialog.css">
	<style type="text/css">
	.loading {
		position: fixed;
		width: 100%;
		height: 100%;
		top: 0px;
		left: 0px;
		z-index: 999;
		background-color: #0d2f43;
	}
	.loading-container {
		width: 40px;
		height: 40px;
		position: absolute;
	}
	.loading-component-1, .loading-component-2 {
		width: 100%;
		height: 100%;
		border-radius: 50%;
		background-color: #f0ad4e;
		opacity: 0.8;
		position: absolute;
		top: 0;
		left: 0;
		-webkit-animation: circulate 2.0s infinite ease-in-out;
		animation: circulate 2.0s infinite ease-in-out;
	}
	.loading-component-2 {
		-webkit-animation-delay: -1.0s;
		animation-delay: -1.0s;
	}
	@-webkit-keyframes circulate {
		0%, 100% {
			-webkit-transform: scale(0.0)
		}
		50% {
			-webkit-transform: scale(1.0)
		}
	}
	@keyframes circulate {
		0%, 100% {
			transform: scale(0.0);
			-webkit-transform: scale(0.0);
		}
		50% {
			transform: scale(1.0);
			-webkit-transform: scale(1.0);
		}
	}
	</style>

<link rel="stylesheet" type="text/css" href="Array/style.css">
	<link rel="stylesheet" type="text/css" href="Array/ansi.css"></head>
<body><link href="Array/jiathis_share.css" rel="stylesheet" type="text/css"><iframe frameborder="0" style="position: absolute; display: none; opacity: 0;" src="Array/saved_resource.html"></iframe><div class="jiathis_style" style="position: absolute; z-index: 1000000000; display: none; top: 50%; left: 50%; overflow: auto;"></div><div class="jiathis_style" style="position: absolute; z-index: 1000000000; display: none; overflow: auto;"></div><iframe frameborder="0" src="Array/jiathis_utility.html" style="display: none;"></iframe>
	<div class="loading" style="display: none;"><div class="loading-container" style="left: 663px; top: 306.5px;"><div class="loading-component-1"></div><div class="loading-component-2"></div></div></div>
	<div class="nav-container">
			<div class="mm_lead_mask" style="display:none;">
				<div class="mm_lead_border"></div>
				<div class="mm_quiz_shu">
					<img src="Array/jt1.png" alt="">
				</div>
				<div class="mm_quiz_font">
					<h1 class="Iknow">
						<img src="Array/x.png" alt="">
					</h1>
					<p>
						<img src="Array/sgj.png" alt="">
					</p>
					<a href="http://www.mengma.com/class/lesson/518/0#" class="Iknow">
						<img src="Array/know.png" alt="">
					</a>
				</div>
			</div>
		<nav class="mm_navbar navbar navbar-inverse navbar-static-top" role="navigation" style="text-align:center;">
			<div class="navbar-header col-md-4 col-sm-4">
				<input type="hidden" value="48" id="vidInput">
				<input type="hidden" value="0" id="ctypeInput">
				<input type="hidden" value="518" id="lidInput">
				<a href="http://www.mengma.com/class/course/48" class="mm_navbar_brand navbar-brand">
					<img src="Array/mm_lesson_back.png" class="mm_lesson_back">
					<span class="mm_navbar_title">PHP</span>
				</a>
			</div>
			<div class="hidden-xs col-md-4 col-sm-4" style="">
				<a href="http://www.mengma.com/" class="mm_navbar_brand">
					<img src="Array/mm_navbar_brand_logo2.svg" class="mm_navbar_brand_logo" style="margin-top:9px; width:108px;height:31px; ">
				</a>
			</div>
			<div class="navbar-right">
				<ul class="nav navbar-nav mm_nav hidden-xs">
					<li class="mm_user dropdown">
						<input type="hidden" value="" id="userNameInput">
						<input type="hidden" value="152441362094156709" id="userId">
						<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
							<span class="mm_user_name">萌小码209...</span>
						</a>
						<ul class="dropdown-menu mm_lesson_navbar_dropdown_menu" role="menu">
							<li class="mm_lesson_dropdown_list">
								<a href="http://profile.mengma.com/user/152441362094156709" target="_blank">
									<img src="Array/mm_white_0.png">
									个人中心
								</a>
							</li>
							<li class="divider"></li>
							<li class="mm_lesson_dropdown_list">
								<a href="http://profile.mengma.com/settings" target="_blank">
									<img src="Array/mm_white_2.png">
									设置
								</a>
							</li>
							<li class="divider"></li>
							<li class="mm_lesson_dropdown_list">
								<a href="http://passport.mengma.com/logout/">
									<img src="Array/mm_white_4.png">
									退出
								</a>
							</li>
						</ul>
					</li>
				</ul>
			</div>
		</nav>
	</div>				
	<div class="mm_wrapper">
		<div class="col-md-4 mm_lesson_left" id="mm_lesson_left">
			<ul class="mm_lesson_tab" id="mm_lesson_tab">
						<li>
							<span></span>
<a href="http://www.mengma.com/class/lesson/513/0">
								<div style="color:#fff;">类型</div>
							</a>
						</li>						<li>
							<span></span>
<a href="http://www.mengma.com/class/lesson/514/0">
								<div style="color:#fff;">Boolean 布尔类型</div>
							</a>
						</li>						<li>
							<span></span>
<a href="http://www.mengma.com/class/lesson/515/0">
								<div style="color:#fff;">Integer 整型</div>
							</a>
						</li>						<li>
							<span></span>
<a href="http://www.mengma.com/class/lesson/516/0">
								<div style="color:#fff;">Float 浮点型</div>
							</a>
						</li>						<li>
							<span></span>
<a href="http://www.mengma.com/class/lesson/517/0">
								<div style="color:#fff;">String 字符串</div>
							</a>
						</li><li class="active">
							<span></span>
							<a href="javascript:void(0)">
								<div style="color:#fff;">Array 数组</div>
							</a>
						</li><li>
							<span></span>
							<a href="javascript:void(0)">
								<div style="color:#fff;">Object 对象</div>
							</a>						</li>						<li>
							<span></span>
							<a href="javascript:void(0)">
								<div style="color:#fff;">Resource</div>
							</a>						</li>						<li>
							<span></span>
							<a href="javascript:void(0)">
								<div style="color:#fff;">NULL</div>
							</a>						</li>						<li>
							<span></span>
							<a href="javascript:void(0)">
								<div style="color:#fff;">Callback回调类型</div>
							</a>						</li>						<li>
							<span></span>
							<a href="javascript:void(0)">
								<div style="color:#fff;">伪类型</div>
							</a>						</li>						<li>
							<span></span>
							<a href="javascript:void(0)">
								<div style="color:#fff;">类型转换的判别</div>
							</a>						</li>			</ul>
			<div class="container-fluid mm_lesson_left_content" style="height: 603px;">
				<div class="mm_lesson_title">
					<img src="Array/mm_check_logo.png" class="mm_check_logo">
					<span class="mm_lesson_title_text">Array 数组</span>
					<div class="pull-right dropdown mm_lesson_title_progress">
						<a href="javascript:void(0)" data-toggle="dropdown">
							6 / 12<i class="fa fa-angle-down mm_icon_right"></i>
						</a>
						<ul class="dropdown-menu mm_lesson_dropdown_menu" role="menu">
							<li><a href="http://www.mengma.com/class/lesson/513/0">
<img src="Array/mm_check_logo.png" class="mm_check_logo">类型								</a>
							</li>							<li><a href="http://www.mengma.com/class/lesson/514/0">
<img src="Array/mm_check_logo.png" class="mm_check_logo">Boolean 布尔类型								</a>
							</li>							<li><a href="http://www.mengma.com/class/lesson/515/0">
<img src="Array/mm_check_logo.png" class="mm_check_logo">Integer 整型								</a>
							</li>							<li><a href="http://www.mengma.com/class/lesson/516/0">
<img src="Array/mm_check_logo.png" class="mm_check_logo">Float 浮点型								</a>
							</li>							<li><a href="http://www.mengma.com/class/lesson/517/0">
<img src="Array/mm_check_logo.png" class="mm_check_logo">String 字符串								</a>
							</li><li class="active">
<a href="http://www.mengma.com/class/lesson/518/0">
									<img src="Array/mm_check_logo_off.png" class="mm_check_logo">Array 数组								</a>
							</li>							<li>								<a href="javascript:void(0)">									<img src="Array/mm_check_logo_off.png" class="mm_check_logo">Object 对象								</a>
							</li>							<li>								<a href="javascript:void(0)">									<img src="Array/mm_check_logo_off.png" class="mm_check_logo">Resource								</a>
							</li>							<li>								<a href="javascript:void(0)">									<img src="Array/mm_check_logo_off.png" class="mm_check_logo">NULL								</a>
							</li>							<li>								<a href="javascript:void(0)">									<img src="Array/mm_check_logo_off.png" class="mm_check_logo">Callback回调类型								</a>
							</li>							<li>								<a href="javascript:void(0)">									<img src="Array/mm_check_logo_off.png" class="mm_check_logo">伪类型								</a>
							</li>							<li>								<a href="javascript:void(0)">									<img src="Array/mm_check_logo_off.png" class="mm_check_logo">类型转换的判别								</a>
							</li>						</ul>
					</div>
				</div>
				<div class="mm_lesson_context" id="mm_lesson_left_cotent" data-simplebar-direction="vertical" style="height: 555px; overflow-x: hidden;">
					<div class="mm_lesson_context_text" tabindex="2" style="height: 80%; overflow-y: hidden; outline: none;">
						<div id="mm_text"><p>班长统计总分成绩单，比如：李雷-652，韩梅梅-632，小明-595；如何用一个变量存放整个班级的成绩单呢？</p>
<p>这里我们可以使用PHP 中的数组来解决。PHP中的数组实际上是一个有序映射。映射是一种把 values 关联到 keys 的类型。此类型在很多方面做了优化，因此可以把它当成真正的数组，或列表（向量），散列表（是映射的一种实现），字典，集合，栈，队列以及更多可能性。这里我们就用到数组在散列表中可能性。</p>
<pre><code class="lang-php">&lt;?php
array(  key =&gt;  value
     , ...
     )
// 键（key）可是是一个整数 integer 或字符串 string
// 值（value）可以是任意类型的值
?&gt;
</code></pre>
<p>还有一种简写方式</p>
<pre><code class="lang-php">&lt;?php
$myClassScores = [ 
                '李  雷' =&gt;  652,
                 '韩梅梅' =&gt;  632 
                  ];
?&gt;
</code></pre>
<h3 id="-">任务：</h3>
<p>请为李雷 韩梅梅的总分存放在数组中</p>
</div>
						<div class="mm_btn_hint">
							<a href="javascript:void(0)" id="mm_btn_hint_toggle" class="btn btn-warning btn-block mm_btn_hint_toggle">提示</a>
							<div id="mm_btn_hint_box" class="mm_btn_hint_box" style="opacity: 0;">
								<div id="mm_hint" class="mm_btn_hint_content"><pre><code class="lang-php">$myClassScores = array(  
                '李  雷' =&gt;  652,
                     '韩梅梅' =&gt;  632
                     );
</code></pre>
</div>
							</div>
						</div>
					</div>
					<img src="Array/mm_lesson_sunrise.png" class="mm_lesson_sunrise" style="width: 455px;">
				</div>
			</div>
		</div>
		<div class="col-md-8 mm_lesson_right hidden-sm" id="mm_lesson_right">
			
			<div class="container-fluid mm_lesson_right_content" style="height: 603px;">
				<div class="mm_lesson_tabbar"> 
						<div id="mm_slide_left_click" style="height:30px; width=35px; float:left; padding:0 12px 0 12px;display:table;padding-top:3px; 	cursor: pointer;">
						<span id="mm_slide_left" style="display:table-cell;text-align:center;vertical-align:middle;font-size:12px;font-weight:300;height:30px;width:30px;background-color:#10354b;opacity:0.5;border-radius:30px;"><i class="fa fa-chevron-left"></i></span>
						</div>
					<ul class="nav nav-tabs mm_lesson_tablist" role="tablist">
						<li class="active">
							<a href="http://www.mengma.com/class/lesson/518/0#mm_tab_code" role="tab" class="mm_tab_code" data-toggle="tab">代码</a>
						</li>
						<li>
							<a href="http://www.mengma.com/class/lesson/518/0#mm_tab_ask" id="mm_tab_question" role="tab" class="mm_tab_ask" data-toggle="tab">相关问题</a>
						</li>
					</ul>
				</div>
				<div class="tab-content mm_lesson_tabbar_content">
					<div id="mm_console_popout" style="z-index:1000;width:100%;background-color:#1a2529;height:220px;position:absolute;left:0;bottom:0;display:none;">
						<span style="font-size:28px;color:#fff;float:right;cursor:pointer;" id="closed">×</span>
						<div style="padding:10px;">
							<span style="color:#fff;">终端：</span>
							<div>
								<textarea id="mm_console" class="form-control" rows="8" placeholder="输入后按回车键运行 @_@" tabindex="1" style="overflow-y: hidden; outline: none;"></textarea>
								<div id="console"></div>
							</div>
						</div>
						<div>

							<a href="http://www.mengma.com/class/lesson/519/0" class="btn btn-success btn-lg mm_btn_run pull-right" id="mm_mask" style="margin-right:10px">下一课</a>							
						</div>
					<div id="ascrail2002" class="nicescroll-rails nicescroll-rails-vr" style="width: 8px; z-index: 1000; cursor: default; position: absolute; top: 0px; left: 92px; height: 120px; display: none;"><div class="nicescroll-cursors" style="position: relative; top: 0px; float: right; width: 8px; height: 0px; border-radius: 5px; background-color: rgb(122, 119, 119); background-clip: padding-box;"></div></div></div>
					<div class="tab-pane active" id="mm_tab_code">
						<div class="mm_lesson_editor">
							<div id="mm_editor" style="height: 491px;"><div class="CodeMirror cm-s-midnight CodeMirror-wrap"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 14px; left: 42px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-hscrollbar" style="left: 38px;"><div style="height: 100%; min-height: 1px; width: 0px;"></div></div><div class="CodeMirror-scrollbar-filler"></div><div class="CodeMirror-gutter-filler"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 38px; min-height: 120px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><div style="width: 50px; height: 50px; overflow-x: scroll;"></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 14px;">&nbsp;</div></div><div class="CodeMirror-code"><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -38px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">1</div></div><pre class=""><span style="padding-right: 0.1px;">&lt;?php </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -38px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">2</div></div><pre class=""><span style="padding-right: 0.1px;"><span class="cm-tab">    </span>$myClassScores = array(  </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -38px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">3</div></div><pre class=""><span style="padding-right: 0.1px;"><span class="cm-tab">    </span><span class="cm-tab">    </span><span class="cm-tab">    </span><span class="cm-tab">    </span>'李  雷' =&gt;  ,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -38px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">4</div></div><pre class=""><span style="padding-right: 0.1px;"><span class="cm-tab">    </span><span class="cm-tab">    </span><span class="cm-tab">    </span> &nbsp; &nbsp; <span class="cm-tab">   </span>'韩梅梅' =&gt;  </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -38px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">5</div></div><pre class=""><span style="padding-right: 0.1px;"><span class="cm-tab">    </span><span class="cm-tab">    </span><span class="cm-tab">    </span> &nbsp; &nbsp; <span class="cm-tab">   </span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -38px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">6</div></div><pre class=""><span style="padding-right: 0.1px;"><span class="cm-tab">    </span><span class="cm-tab">    </span><span class="cm-tab">    </span> &nbsp; &nbsp; <span class="cm-tab">   </span>);</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -38px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">7</div></div><pre class=""><span style="padding-right: 0.1px;"><span class="cm-tab">    </span>var_dump($myClassScores); </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -38px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">8</div></div><pre class=""><span style="padding-right: 0.1px;">?&gt;</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px; top: 120px;"></div><div class="CodeMirror-gutters" style="height: 481px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 28px;"></div><div class="CodeMirror-gutter CodeMirror-foldgutter"></div></div></div></div></div>
						</div>
						<div class="mm_lesson_editor_panel">
							<a href="javascript:void(0)" id="mm_editor_undo" class="btn btn-default btn-lg mm_btn_undo">
								<i class="fa fa-angle-left mm_undo"></i>
							</a>
							<a href="javascript:void(0)" id="mm_editor_redo" class="btn btn-default btn-lg mm_btn_redo">
								<i class="fa fa-angle-right mm_redo"></i>
							</a>
							<a href="javascript:void(0)" id="mm_editor_reset" class="btn btn-default btn-lg mm_btn_reset">重置</a>
							<a href="javascript:void(0)" id="mm_editor_run" class="btn btn-success btn-lg mm_btn_run pull-right disabled">运行</a>
							<input type="hidden" value="9" id="langId">
						</div>
					</div>
					<div class="tab-pane" id="mm_tab_timemachine"></div>
					<div class="tab-pane" id="mm_tab_ask">
						<div class="mm_lesson_ask" style="overflow-y: hidden; width: 100%; padding: 0px; height: 555px; outline: none;" tabindex="0">
							<iframe src="Array/saved_resource(1).html" width="100%" height="100%" frameborder="0"></iframe>
						</div>
					</div>
				</div>
			</div>
			<div class="modal fade" id="mm_share_popout" tabindex="-1" role="dialog" aria-labelledby="mm_share_title" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content mm_panel">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
							<h4 class="modal-title" id="mm_share_title">分享</h4>
						</div>
						<div class="modal-body">
							<!-- JiaThis Button BEGIN -->
							<div class="jiathis_style_32x32 clearfix">
							<a class="jiathis_button_weixin" title="分享到微信"><span class="jiathis_txt jtico jtico_weixin"></span></a>
							<a class="jiathis_button_tsina" title="分享到微博"><span class="jiathis_txt jtico jtico_tsina"></span></a>
							<a class="jiathis_button_qzone" title="分享到QQ空间"><span class="jiathis_txt jtico jtico_qzone"></span></a>
							<a class="jiathis_button_cqq" title="分享到QQ好友"><span class="jiathis_txt jtico jtico_cqq"></span></a>
							<a class="jiathis_button_renren" title="分享到人人网"><span class="jiathis_txt jtico jtico_renren"></span></a>
							<a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis" target="_blank"></a>
							</div>
							<script type="text/javascript">
							var jiathis_config={
								data_track_clickback: true,
								url: "www.mengma.com",
								summary: "",
								title: "亲测，这里是太阳系学习编程最好的地方! http://www.mengma.com #萌码#",
								pic: "s.mengma.com/img/mm_icon.png",
								ralateuid:{
									"tsina": "5296436353"
								},
								appkey:{
									"tsina": "4092659152"
								},
								shortUrl: false,
								hideMore: false
							}
							</script>
							<script type="text/javascript" src="Array/jia.js" charset="utf-8"></script><script type="text/javascript" src="Array/plugin.client.js" charset="utf-8"></script>
							<!-- JiaThis Button END -->
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

<script type="text/javascript" src="Array/common.min_e424ea--.js"></script>
<script type="text/javascript">
(function($) {
	$.fn.loading = function(options) {
		var el = $(this);
		el.html('<div class="loading-container"><div class="loading-component-1"></div><div class="loading-component-2"></div></div>');
		resize();
		$(document).ready(function() {
			setTimeout(function() {
				$(el).fadeOut();
			}, 1000);
		});
	};
	var resize = function() {
		$('.loading-container').css({
			"left": ($(window).width() / 2) - ($('.loading-container').outerWidth() / 2),
			"top": ($(window).height() / 2) - ($('.loading-container').outerHeight() / 2)
		});
	};
	$(window).load(function() {
		resize();
		$(window).resize(function() {
			resize();
		});
	});
}(jQuery));
$(".loading").loading();
</script>
<script type="text/javascript" src="Array/bootstrap.min_7b82cf--.js"></script>
<script type="text/javascript" src="Array/ifvisible.js"></script>
<script type="text/javascript" src="Array/mm_lesson_run_047c8a--.js"></script>
<!-- <script type="text/javascript" src="s.mengma.com/js/simplebar.js"></script> -->

<script type="text/javascript">
/** RESPONSIVE **/
$(".container-fluid").height($(document).height() - 50);
$(".mm_lesson_context").height($(".container-fluid").height() - 64);
$(".mm_lesson_context_text").css({'height':'80%'})
$(".mm_lesson_context").css("overflow-x",'hidden');	
$("#mm_editor").css({
	'height':$(".container-fluid").height() - 112
});
$(".mm_timemachine").height($(".container-fluid").height() - 48);
$(".CodeMirror").height($(".container-fluid").height() - 112);
$(".mm_lesson_ask").css({
	'height': $(".container-fluid").height() - 48,
	'overflow-y':'scroll'
});
$(".mm_lesson_ask").niceScroll({
	styler:"fb", 
	cursorwidth:"8px",
	cursorcolor:"#7a7777",
	cursorborder:"",
	horizrailenabled: false
});

$(".mm_lesson_sunrise").width($(".mm_lesson_left_content").width());
$(window).resize(function() {
	$(".mm_lesson_sunrise").width($(".mm_lesson_left_content").width());
});
</script><div id="ascrail2000" class="nicescroll-rails nicescroll-rails-vr" style="width: 8px; z-index: auto; cursor: default; position: absolute; top: 0px; left: 92px; height: 555px; display: none;"><div class="nicescroll-cursors" style="position: relative; top: 0px; float: right; width: 8px; height: 0px; border-radius: 5px; background-color: rgb(122, 119, 119); background-clip: padding-box;"></div></div>
<script type="text/javascript" src="Array/codemirror.js"></script>
<script type="text/javascript" src="Array/sublime.js"></script>
<script type="text/javascript" src="Array/foldcode.js"></script>
<script type="text/javascript" src="Array/foldgutter.js"></script>
<script type="text/javascript" src="Array/brace-fold.js"></script>
<script type="text/javascript" src="Array/xml-fold.js"></script>
<script type="text/javascript" src="Array/comment-fold.js"></script>
<script type="text/javascript" src="Array/matchbrackets.js"></script>
<script type="text/javascript" src="Array/closebrackets.js"></script>
<script type="text/javascript" src="Array/searchcursor.js"></script>
<script type="text/javascript" src="Array/search.js"></script>
<script type="text/javascript" src="Array/dialog.js"></script>
<script type="text/javascript" src="Array/php.js"></script>

<script type="text/javascript" src="Array/show-hint.js"></script>
<script type="text/javascript" src="Array/php-hint.js"></script>
<link rel="stylesheet" type="text/css" href="Array/show-hint.css">

<script type="application/json" id="mm_data_conf">["%3C%3Fphp%20%0A%09%24myClassScores%20%3D%20array(%20%20%0A%09%09%09%09'%E6%9D%8E%20%20%E9%9B%B7'%20%3D%3E%20%20%2C%0A%09%09%09%20%20%20%20%20%09'%E9%9F%A9%E6%A2%85%E6%A2%85'%20%3D%3E%20%20%0A%09%09%09%20%20%20%20%20%09%0A%09%09%09%20%20%20%20%20%09)%3B%0A%09var_dump(%24myClassScores)%3B%20%0A%3F%3E", "%3C%3Fphp%20%0A%09%24myClassScores%20%3D%20array(%20%20%0A%09%09%09%09'%E6%9D%8E%20%20%E9%9B%B7'%20%3D%3E%20%20%2C%0A%09%09%09%20%20%20%20%20%09'%E9%9F%A9%E6%A2%85%E6%A2%85'%20%3D%3E%20%20%0A%09%09%09%20%20%20%20%20%09%0A%09%09%09%20%20%20%20%20%09)%3B%0A%09var_dump(%24myClassScores)%3B%20%0A%3F%3E", "application/x-httpd-"]</script>
<script type="application/json" id="mm_data_text">["%E7%8F%AD%E9%95%BF%E7%BB%9F%E8%AE%A1%E6%80%BB%E5%88%86%E6%88%90%E7%BB%A9%E5%8D%95%EF%BC%8C%E6%AF%94%E5%A6%82%EF%BC%9A%E6%9D%8E%E9%9B%B7-652%EF%BC%8C%E9%9F%A9%E6%A2%85%E6%A2%85-632%EF%BC%8C%E5%B0%8F%E6%98%8E-595%EF%BC%9B%E5%A6%82%E4%BD%95%E7%94%A8%E4%B8%80%E4%B8%AA%E5%8F%98%E9%87%8F%E5%AD%98%E6%94%BE%E6%95%B4%E4%B8%AA%E7%8F%AD%E7%BA%A7%E7%9A%84%E6%88%90%E7%BB%A9%E5%8D%95%E5%91%A2%EF%BC%9F%0A%0A%E8%BF%99%E9%87%8C%E6%88%91%E4%BB%AC%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8PHP%20%E4%B8%AD%E7%9A%84%E6%95%B0%E7%BB%84%E6%9D%A5%E8%A7%A3%E5%86%B3%E3%80%82PHP%E4%B8%AD%E7%9A%84%E6%95%B0%E7%BB%84%E5%AE%9E%E9%99%85%E4%B8%8A%E6%98%AF%E4%B8%80%E4%B8%AA%E6%9C%89%E5%BA%8F%E6%98%A0%E5%B0%84%E3%80%82%E6%98%A0%E5%B0%84%E6%98%AF%E4%B8%80%E7%A7%8D%E6%8A%8A%20values%20%E5%85%B3%E8%81%94%E5%88%B0%20keys%20%E7%9A%84%E7%B1%BB%E5%9E%8B%E3%80%82%E6%AD%A4%E7%B1%BB%E5%9E%8B%E5%9C%A8%E5%BE%88%E5%A4%9A%E6%96%B9%E9%9D%A2%E5%81%9A%E4%BA%86%E4%BC%98%E5%8C%96%EF%BC%8C%E5%9B%A0%E6%AD%A4%E5%8F%AF%E4%BB%A5%E6%8A%8A%E5%AE%83%E5%BD%93%E6%88%90%E7%9C%9F%E6%AD%A3%E7%9A%84%E6%95%B0%E7%BB%84%EF%BC%8C%E6%88%96%E5%88%97%E8%A1%A8%EF%BC%88%E5%90%91%E9%87%8F%EF%BC%89%EF%BC%8C%E6%95%A3%E5%88%97%E8%A1%A8%EF%BC%88%E6%98%AF%E6%98%A0%E5%B0%84%E7%9A%84%E4%B8%80%E7%A7%8D%E5%AE%9E%E7%8E%B0%EF%BC%89%EF%BC%8C%E5%AD%97%E5%85%B8%EF%BC%8C%E9%9B%86%E5%90%88%EF%BC%8C%E6%A0%88%EF%BC%8C%E9%98%9F%E5%88%97%E4%BB%A5%E5%8F%8A%E6%9B%B4%E5%A4%9A%E5%8F%AF%E8%83%BD%E6%80%A7%E3%80%82%E8%BF%99%E9%87%8C%E6%88%91%E4%BB%AC%E5%B0%B1%E7%94%A8%E5%88%B0%E6%95%B0%E7%BB%84%E5%9C%A8%E6%95%A3%E5%88%97%E8%A1%A8%E4%B8%AD%E5%8F%AF%E8%83%BD%E6%80%A7%E3%80%82%0A%20%20%0A%60%60%60php%20%20%20%20%0A%3C%3Fphp%0Aarray(%20%20key%20%3D%3E%20%20value%0A%20%20%20%20%20%2C%20...%0A%20%20%20%20%20)%0A%2F%2F%20%E9%94%AE%EF%BC%88key%EF%BC%89%E5%8F%AF%E6%98%AF%E6%98%AF%E4%B8%80%E4%B8%AA%E6%95%B4%E6%95%B0%20integer%20%E6%88%96%E5%AD%97%E7%AC%A6%E4%B8%B2%20string%0A%2F%2F%20%E5%80%BC%EF%BC%88value%EF%BC%89%E5%8F%AF%E4%BB%A5%E6%98%AF%E4%BB%BB%E6%84%8F%E7%B1%BB%E5%9E%8B%E7%9A%84%E5%80%BC%0A%3F%3E%0A%60%60%60%0A%E8%BF%98%E6%9C%89%E4%B8%80%E7%A7%8D%E7%AE%80%E5%86%99%E6%96%B9%E5%BC%8F%0A%0A%60%60%60php%20%20%20%20%0A%3C%3Fphp%0A%24myClassScores%20%3D%20%5B%20%0A%09%09%09%09'%E6%9D%8E%20%20%E9%9B%B7'%20%3D%3E%20%20652%2C%0A%09%09%20%20%20%20%20%09'%E9%9F%A9%E6%A2%85%E6%A2%85'%20%3D%3E%20%20632%20%0A%09%09%20%20%09%09%5D%3B%0A%3F%3E%0A%60%60%60%0A%0A%23%23%23%20%E4%BB%BB%E5%8A%A1%EF%BC%9A%0A%0A%E8%AF%B7%E4%B8%BA%E6%9D%8E%E9%9B%B7%20%E9%9F%A9%E6%A2%85%E6%A2%85%E7%9A%84%E6%80%BB%E5%88%86%E5%AD%98%E6%94%BE%E5%9C%A8%E6%95%B0%E7%BB%84%E4%B8%AD%0A"]</script>
<script type="application/json" id="mm_data_hint">["%60%60%60php%20%20%0A%24myClassScores%20%3D%20array(%20%20%0A%09%09%09%09'%E6%9D%8E%20%20%E9%9B%B7'%20%3D%3E%20%20652%2C%0A%09%09%09%20%20%20%20%20%09'%E9%9F%A9%E6%A2%85%E6%A2%85'%20%3D%3E%20%20632%0A%09%09%09%20%20%20%20%20%09)%3B%20%0A%60%60%60%0A"]</script>
<script type="application/json" id="mm_data_code">["%5C%3D%5C%3E%5Cs*%5Cd%2B.*%5Cn%2B.*%5C%3D%5C%3E%5Cs*%5Cd%2B.*%5Cn%2B"]</script>
<script type="text/javascript" src="Array/mm_lesson_04588d--.js"></script>
<script type="text/javascript" src="Array/mm_common_018fd9--.js"></script><script src="Array/h.js" type="text/javascript"></script><div id="ascrail2001" class="nicescroll-rails nicescroll-rails-vr" style="width: 8px; z-index: 99; cursor: default; position: fixed; top: 0px; height: 100%; right: 0px; display: none;"><div class="nicescroll-cursors" style="position: relative; top: 0px; float: right; width: 8px; height: 0px; border-radius: 5px; background-color: rgb(122, 119, 119); background-clip: padding-box;"></div></div>
<script id="test_template" type="text/x-template">
	<div style="background:url(http://s.mengma.com/img/mm_guidepage.jpg);position:absolute;left:0;top:0;width:100%;height:100%;">
		<div class="mm_temp_title" style="margin-top:50px;color:white">{{title}}</div>
		<div class="mm_temp_title" style="font-size:38px; color:white">{{description}}</div>
	</div>
</script>

<script type="text/javascript">
var next = true;
var $emailSent=false;
var mm_left_width = $("#mm_lesson_left_cotent").width();
function finishPopup(){
Phenix.init({
	width: 300,
	height: 330,
	template:'<div style="background:url(http://s.mengma.com/img/mm_guidepage.jpg);position:absolute;left:0;top:0;width:100%;height:100%;"><div class="mm_temp_title" style="margin-top:50px;color:white">{{title}}</div><div class="mm_temp_title" style="font-size:28px; color:white">{{description}}</div></div>',
	data: {
		color: "#36b14a",
		title: " ",
		description: "你已学完全部课程！"
	}
}).show(function() {
		setTimeout(function() {
			Phenix.hide();
		},2000);
	});
}
$(function() {
	/* scroll */
	// $("html").getNiceScroll().hide();
	var niceScroll = false;
	if(!(navigator.userAgent.indexOf('Mac OS X') > 0)) {
		niceScroll = $(".mm_lesson_context_text").niceScroll({
			styler:"fb", 
			cursorwidth:"8px",
			cursorcolor:"#7a7777",
			cursorborder:"",
			horizrailenabled: false
		});
	}else{
		$(".mm_lesson_context_text").css("overflow-y","scroll");
	}
	// modify default table style 
	if (!$("table").hasClass()) {
		$("table").addClass("table table-bordered");
	}
console.log("php")
	CodeMirror.commands.autocomplete=function(cm) {
    	CodeMirror.showHint(cm, CodeMirror.phpHint, {
        	"completeSingle" : false
    	});
	};	$("#closed").click(function() {
		$("#mm_console_popout").hide();
	});
	$(".jqconsole").eq(0).css("margin-top","28px");
	$(".jqconsole").eq(0).css("height","100px");
	$(".jqconsole").eq(0).css("background-color","#1a2529");
	var $mm_lesson_links = $("#mm_text").find("a");
	if($mm_lesson_links.length > 0) {
		for(var i = 0; i < $mm_lesson_links.length; i++) {
			$mm_lesson_links.eq(i).attr("target","_blank");
		}
	}
	var learnCourse_10=function(){
		Phenix.init({
			width: 500,
			height: 280,
			template: '<div class="mm_temp_title" style="padding:0 20px;font-size:14px;color:#7f7f7f;">大神，代码神功在修炼的过程中，不知少侠感觉如何？<br />有木有感觉代码萌萌哒呢，那你可以点击<a id="mm_temp_share" href="#" style="text-decoration:underline;">分享</a>，把网站告诉你的小伙伴们，或者感觉网站有任何问题也可以点击<a href="http://www.mengma.com/about/#mm_feedback_h1" target="_blank" style="text-decoration:underline;">意见反馈</a>，跟产品汪吐槽</div><a id="mm_tolearn" class="mm_temp_learn" style="cursor:po">我要继续学习</a>',
		}).show(function() {
			$("#mm_temp_share").click(function() {
				Phenix.hide();
				$("#mm_share_popout").modal('show');
			});
			$("#mm_tolearn").click(function() {
				Phenix.hide();
				$("#mm_console_popout").show();
			});
		});
	}
	var learnCourse_5=function(){
		Phenix.init({
			width: 400,
			height: 420,
			template: '<div class="mm_temp_title">惊现隐藏任务</div><div class="mm_temp_des" style="padding:0 30px;">嗨，大神，您已经学习过4课了，为了更好地通知您最新的课程消息，以及跟进您的学习进度，我们需要对您的邮箱进行验证。</div><div style="margin-top:10px;"><span id="mm_email_tip" style="height:20px;;text-align:left;color:#6f6f6f;font-size:12px;width:340px;display:inline-block;"></span><input id="mm_email" type="text" class="form-control" style="margin:0 auto;width:340px;height:40px;margin-bottom:10px;" placeholder="请输入您的邮箱地址" /></div><span id="mm_captcha_tip" style="text-align:left;color:#6f6f6f;font-size:12px;width:340px;display:inline-block;"></span><div class="input-group" id="mm_verify" style="display:none;width:340px;margin:0 auto;"><div class="input-group-addon" style="padding:0; margin:0;"><img src="http://www.mengma.com/api/reg/captcha/" id="mm_img_captcha" onclick="this.src=\'http://www.mengma.com/api/reg/captcha/\'+new Date()*1" style="height:40px;" title="点击刷新验证码" /></div><input class="form-control" type="text" placeholder="请输入验证码（点击图片刷新）" name="captcha" required minlength="1" maxlength="2" listen-to-code="107" id="mm_captcha" style="height:40px;"/></div><div style="margin-top:20px;padding:0 30px;"><a id="mm_goto_mail" class="mm_temp_cancel">以后再说</a><a id="mm_temp_send" class="mm_temp_send">发送验证邮件</a></div>',
		}).show(function() {
			$("#mm_goto_mail").click(function() {
				Phenix.hide();
				$("#mm_console_popout").show();
			});
			$("#mm_email").focus(function() {
				$("#mm_email_tip").html("");
				$("#mm_verify").show(200);
				$("#mm_email").removeClass("mm_form_error");
			});
			$("#mm_captcha").focus(function() {
				$("#mm_captcha_tip").html("");
				$("#mm_captcha").removeClass("mm_form_error");
			});
			$("#mm_temp_send").click(function() {
				if (!(/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/.test($("#mm_email").val()))){
					$("#mm_email_tip").html("请输入正确的邮箱地址，如xx@xx.com");
					$("#mm_email").addClass("mm_form_error");
				} else if($("#mm_captcha").val().length == 0) {
					$("#mm_captcha_tip").html("请输入正确的验证码");
					$("#mm_captcha").addClass("mm_form_error");
				} else {
					var email_host=$("#mm_email").val().split("@")[1];
					M.ajax("/api/auth/saveemail", {
						email: $("#mm_email").val(),
						captcha: $("#mm_captcha").val()
					}, function(data) {
						if (data['code'] == 0) {
							Phenix.init({
								width: 420,
								height: 280,
								template: '<div class="mm_temp_title">发送成功</div><div class="mm_temp_des" style="padding:0 30px;">已经向你的邮箱发送了一封验证邮件，快去查收哦</div><div style="margin-top:20px;padding:0 30px;"><a id="mm_goto_learn" class="mm_temp_cancel" style="width:180px;">知道了，我先学完这节课</a><a id="mm_goto_mail" class="mm_temp_send">前往邮箱</a></div>',
							}).show(function() {
								$("#mm_goto_learn").click(function() {
									Phenix.hide();
									$("#mm_console_popout").show();
								});
								$("#mm_goto_mail").click(function() {
									window.location.href="http://mail." + email_host;
								});
							});
						} else if (data['code'] == 1) {
							$("#mm_email_tip").html("非法请求！");
						} else if (data['code'] == 2) {
							$("#mm_img_captcha").attr("src", "http://www.mengma.com/captcha/" + new Date() * 1);
							$("#mm_captcha").val("");
							$("#mm_captcha_tip").html("验证码错误！");
							$("#mm_captcha").addClass("mm_form_error");
						} else if (data['code'] == 408) {
							$("#mm_img_captcha").attr("src", "http://www.mengma.com/captcha/" + new Date() * 1);
							$("#mm_captcha").val("")
							$("#mm_email_tip").html("此邮箱已被注册！");
							$("#mm_email").addClass("mm_form_error");
						}
					}, function() {
						popup("#b9b9bd", ":(", "操作失败！可能木有吃药，感觉自己萌萌哒！");
					});
				}
			});
		});
	}
	var sendMailAgain=function() {
		Phenix.init({
			width: 500,
			height: 280,
			template: '<div class="mm_temp_title">激活邮件</div><div class="mm_temp_title" style="padding:0 20px;font-size:14px;color:#7f7f7f;">在萌码学习感觉如何呢？如果觉得不错的话别忘了去激活邮箱哦~</div><div style="margin-top:20px;padding:0 30px;"><a id="mm_resend_email" class="mm_temp_cancel" data-loading-text="发送中..." style="width:160px;">重新发送验证邮件</a><a id="mm_to_learn" class="mm_temp_send">好的，我知道了</a></div>',
		}).show(function() {
			$("#mm_to_learn").click(function() {
				Phenix.init().hide(function() {
					timeMachine();
				});
			});
			$("#mm_resend_email").click(function() {
				$emailSent=true;
				var $btn=$(this).button("loading");
				Phenix.init().hide(function() {
					timeMachine();
				});
				M.ajax("/api/auth/sendverifyemail", {}, function(data) {
					$btn.button('reset');
					if (data["code"] && data["code"] == "119") {
						popup("#36b14a", ":)", "这个邮箱已经通过验证");
					} else if (data['code'] == 1) {
						popup("#b9b9bd", ":(", "发送失败！");
					} else if (data["code"] == 0) {
						popup("#36b14a", ":)", "发送成功，请尽快验证~");
					}
				});
			});
		});
	}
	var timeMachine=function() {
		if (!$(".mm_tab_timemachine")[0]) {
			$(".mm_lesson_tablist>li:first").after("<li><a href=\"#mm_tab_timemachine\" role=\"tab\" class=\"mm_tab_timemachine\" data-toggle=\"tab\">时光机</a></li>");
		}
		$("#mm_tab_timemachine").html("<iframe src=\"http://www.mengma.com/timemachine/518/0\" class=\"mm_timemachine\"></iframe>");
		$(".mm_timemachine").height($(".container-fluid").height() - 48);
		$("#mm_console_popout").show();
		$("#mm_console").val("");
		$("#mm_console").data("run", true);	}
	var popup=function(color, face, title) {
		Phenix.init({
			width: 500,
			height: 300,
			template: '<div style="color:' + color + ';" class="mm_temp_face">' + face + '</div><div class="mm_temp_title">' + title + '</div>',
		}).show(function() {
			setTimeout(function() {
				Phenix.hide();
			}, 3000);
		});
	}

	$("#mm_editor_run").click(function() {
		if (1 == 0) {
				$(".mm_lead_mask").show();
				$("#mm_btn_timemachine").addClass("mm_lead_border");
			$(".Iknow").on("click",function(){
				$("#mm_btn_timemachine").removeClass("mm_lead_border");
				$(".mm_lead_mask").hide();
			})
		} else {
			$(".mm_lead_mask").hide();
		}
		if ($(this).data("ok")) {
			M.ajax("/api/run/savecodeandjudgeverify", {
				lid: 518,
				content: encodeURIComponent(m.open("editor").getValue())
			}, function(data) {
				if(data['code'] == "400001"){
					if(confirm("还未登录，请先登录")) { 
						window.location.href = "http://passport.mengma.com/";
					}else{
						window.location.href = "http://passport.mengma.com/";
					}
				}
				if (!$(".mm_tab_timemachine")[0] && 0 != "0") {
					$(".mm_lesson_tablist>li:first").after("<li><a href=\"#mm_tab_timemachine\" role=\"tab\" class=\"mm_tab_timemachine\" data-toggle=\"tab\">时光机</a></li>");
				}
				$("#mm_tab_timemachine").html("<iframe src=\"http://www.mengma.com/timemachine/518/0\" class=\"mm_timemachine\"></iframe>");
				lessonPop(data['code'], data['score'], false, "");
				$("#mm_console").val("");
				$("#mm_console").data("run", true);			}, function() {
				popup("#b9b9bd", ":(", "网络有问题！可能木有吃药，感觉自己萌萌哒！");
			});
		}
	});
	
	$(document).keydown(function(e) {
		if(e.keyCode == 120) {
			$("#mm_editor_run").click();
		}
	});
	var t , runcodetime = 0;
	$("#mm_console").on("keypress", function(e) {
	
	
		if ($("#mm_console").data("run")) {
			if (e.which == 13) {
				$("#mm_console").data("run", false);
				M.ajax("/api/run/simulate", {
					lid: 518,
					input: $("#mm_console").val(),
					out: null,
					ctype:0				}, function(data) {
					if(next){
					$("#mm_console").val($("#mm_console").val() + data + "——————————————————\n按回车键将会进入下一课，点击关闭返回");
					console.debug(data);
					}
					else{
					$("#mm_console").val($("#mm_console").val() + data + "——————————————————\n恭喜您完成了本门课程的学习！按回车键，返回到课程列表页，继续学习其他课程。");
					console.debug(data);
					}
				}, function() {
					$("#mm_console").data("run", true);
					popup("#b9b9bd", ":(", "网络有问题！可能木有吃药，感觉自己萌萌哒！");
				});
			}
		} else {
			if (e.which == 13) {
				if (next){
				$("#mm_console_popout").hide();
					window.location.href="http://www.mengma.com/class/lesson/519/0";
				}
				else{
					finishPopup();
					window.location.href="http://www.mengma.com/volumes"
				}
			} 
			else {
				e.preventDefault();
			}
		}
	});
	function getRunResult(data){
		$.ajax({
			type:'GET',
			xhrFields: {
              	withCredentials: true
          	},
			url:'http://api.mengma.com/runcode/',
			data:"getresult="+JSON.stringify(data),
			success:function(response){
				if(response.code=="400304"){
					if(runcodetime<6){
						$('#mm_console').val("运行中...");
					}else{
						clearInterval(t);
						$('#mm_console').val("运行超时");
					}
				}else{
					if(response.errors){
						$('#mm_console').val($("#mm_console").val() + "\n语法有误，请修改代码，重新运行\n——————————————————\n" +response.errors);
					}else{
						if(response.output){
							if(next){
								$('#mm_console').val($("#mm_console").val() + response.output + "\n——————————————————\n按回车键将会进入下一课，点击关闭返回");
							}else{
								$("#mm_console").val($("#mm_console").val() + data + "——————————————————\n恭喜您完成了本门课程的学习！按回车键，返回到课程列表页，继续学习其他课程。");
							}
						}else{
							if(next){
								$('#mm_console').val($("#mm_console").val() + "——————————————————\n按回车键将会进入下一课，点击关闭返回");
							}else{
								$("#mm_console").val($("#mm_console").val() + data + "——————————————————\n恭喜您完成了本门课程的学习！按回车键，返回到课程列表页，继续学习其他课程。");
							}
						}
					}
					clearInterval(t);

				}
			}
		});
	}
	/*slide left*/
	var isSlide = true;
	$("#mm_slide_left_click").on("click",function(){
		if(isSlide){
			
			// niceScroll.remove();
			$("#mm_lesson_left_cotent").css({'overflow':'hidden'});
			$(".mm_lesson_sunrise").hide();
			// $("#mm_lesson_left").animate({"width":"0%"});
			$('#mm_lesson_left').animate({
				left:"-1px",
				width:"0px"
			},500,function(){
				$(".mm_lesson_context_text").hide();
				$(".mm_lesson_left_content").hide();
				$(".mm_lesson_tab").fadeIn();
			});
				
			$(".mm_lesson_editor_panel").css({"width":"98%"});
			$("#mm_lesson_right").animate({
	        	width:"97%",
	        	left:"3%"
	        });
	        $(this).find("i").removeClass("fa-chevron-left").addClass("fa-chevron-right");
			$("#mm_tab_ask").animate({
				"left":"2%",
				"width":"98%"
			});
			isSlide = false;
		} else if (isSlide == false){
			isSlide = true;

			$("#mm_lesson_tab").hide();
			$(".mm_lesson_editor_panel").animate({"width":"100%"},500);
			$("#mm_lesson_left").animate({
				"left":"0px",
				"width":'33.33333333%'
			},500,function(){
				$(".mm_lesson_context_text").show();
			});
			$(".mm_lesson_left_content").show();

			$("#mm_lesson_right").animate({
				"width":"66.66666667%",
				"left":'0%'
			},500);
			$(this).find("i").removeClass("fa-chevron-right").addClass("fa-chevron-left");
			$("#mm_tab_ask").animate({
				"left":"33.33333333%",
				"width":"66.66666667%"
			},600,function(){
				if(!(navigator.userAgent.indexOf('Mac OS X') > 0)) {
					niceScroll = $(".mm_lesson_context_text").niceScroll({
						styler:"fb", 
						cursorwidth:"8px",
						cursorcolor:"#7a7777",
						cursorborder:"",
						horizrailenabled: false
					});
				}else{
					$(".mm_lesson_context_text").css("overflow-y","scroll");
				}
			});
			$(".mm_lesson_sunrise").show();
			isLeft = true;
			
            /*$("#mm_lesson_left").animate({"width":"33.33333333%"},300,function(){
            	if(!(navigator.userAgent.indexOf('Mac OS X') > 0)) {
	            	niceScroll = $(".mm_lesson_context_text").niceScroll({
						styler:"fb", 
						cursorwidth:"8px",
						cursorcolor:"#7a7777",
						cursorborder:"",
						horizrailenabled: false
					});
            	}else{
            		$(".mm_lesson_context_text").css('overflow-y','scroll');
            	}
            });

			$("#mm_slide_left").find($(".fa")).removeClass('fa-chevron-right').addClass('fa-chevron-left');
			$('.mm_lesson_title_text').css('visibility','visible');
			$(".mm_lesson_context_text").show();
			$(".mm_lesson_sunrise").show();*/
		}
	});
	/** mm_lesson_navbar_dropdown_menu li bind hover event **/
	$('ul.mm_lesson_navbar_dropdown_menu li.mm_lesson_dropdown_list').hover(function(){
		$(this).find('img').attr('src','http://s.mengma.com/img/mm_navbar/mm_gray_'+$(this).index()+'.png');
	},function(){
		$(this).find('img').attr('src','http://s.mengma.com/img/mm_navbar/mm_white_'+$(this).index()+'.png');
	});

	$('ul.mm_lesson_tab li').hover(function(e){
		$(this).find('span').css({
			'background' : 'url(http://s.mengma.com/img/mm_tab/hoverRound.png) no-repeat center'
		});
		$(this).find('div').stop().animate({left:'30', opacity:1}, 'fast').css('display','block');
		
	},function(){
		if($(this).hasClass('active')==true){
			$(this).find('span').css({
				'background' : 'url(http://s.mengma.com/img/mm_tab/activeRound.png) no-repeat center'
			});
		}else{
			$(this).find('span').css({
				'background' : 'url(http://s.mengma.com/img/mm_tab/round.png) no-repeat center'
			});
		}
		$(this).find('div').stop().animate({left:'0', opacity:0}, 'fast').css('display','none');
	});
	var failPopup = function(title, func) {
		Phenix.init({
			width: 500,
			height: 300,
			template: "<div style=\"color:{{color}};\" class=\"mm_temp_face\">{{face}}</div><div class=\"mm_temp_title\">{{title}}</div>",
			data: {
				color: "#b9b9bd",
				face: ":(",
				title: title,
			}
		}).show(function() {
			setTimeout(function() {
				if(typeof func == "undefined") {
					Phenix.hide();
				} else {
					func();
				}
			},3000);
		});
	};
	var phenixs = function(integral){
		Phenix.init({
			width: 300,
			height: 330,
			template: document.getElementById('test_template').innerHTML,
			data: {
				color: "#36b14a",
				title: "学完本节",
				description: "积分+"+integral
			}
		}).show();
	};
});
</script>
<div id="ascrail2003" class="nicescroll-rails nicescroll-rails-vr" style="width: 8px; z-index: 2; cursor: default; position: absolute; top: 114px; left: 447px; height: 482px; opacity: 0;"><div class="nicescroll-cursors" style="position: relative; top: 0px; float: right; width: 8px; height: 311px; border-radius: 5px; background-color: rgb(122, 119, 119); background-clip: padding-box;"></div></div></body></html>